<?php
/**
 * File : ConfigReader.php
 * Created by Ludovic Reenaers
 * Created on  9 nov. 2010
 * lreenaers@hotmail.com
 */
class ConfigReader{
	public function __construct()
	{
			
		$this->currentFile = "xml/server.xml";
		$this->domFile = new DOMDocument('1.0', 'utf-8');
		$this->domFile->preserveWhiteSpace = false;
		$this->domFile->load($this->currentFile);
	}
	public function getItemValue( $itemName )
	{
		$val = $itemName." is null";
		$srv = $this->domFile->getElementsByTagName("server");
		foreach ($srv as $elem){
			$items = $elem->getElementsByTagName($itemName);
			if ($items != NULL){
				foreach ($items as $item){
					$val = $item->nodeValue;
				}
			}
		}
		return $val;
			
			
	}
	public function __get( $itemName )
	{
		return $this->getItemValue( $itemName );
	}
}
?>